-
Notifications
You must be signed in to change notification settings - Fork 123
Add elasticstack_kibana_default_data_view resource to manage default data view #1379
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: tobio <[email protected]>
Co-authored-by: tobio <[email protected]>
Co-authored-by: tobio <[email protected]>
b9dd33a to
9b64020
Compare
…ata-view-resource * origin/main: chore(deps): update golang:1.25.3 docker digest to bce1e7e (#1382) Clean before regenerating the client Clean before regenerating the client Use a working API spec chore(deps): update kibana-openapi-spec digest to 9b8ef82 (#1377) Include the generated client in the post upgrade task
|
@tobio , shouldn't the default setting of a dataview be better of as a property of the dataview resource itself rather a separate resource? Or is the API built weird here? |
@Kushmaro setting the default dataview is a distinct API endpoint, rather than a property of the dataview itself, so we're partly modelling that. We could still make this a property of the dataview resource, and just make multiple API calls, I did think about doing that, but IMO having a separate resource makes a little more sense:
So it feels like defining this in the dataview resource itself, actually becomes |
|
gotcha @tobio , thanks for clarifying! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a new elasticstack_kibana_default_data_view resource that enables programmatic management of Kibana's default data view setting through Terraform, addressing a limitation where this could previously only be configured through the Kibana UI.
Key Changes:
- New resource implementation with support for setting, updating, and conditionally unsetting the default data view
- Integration with Kibana's default data view API endpoints
- Comprehensive acceptance tests covering basic operations, updates, skip_delete behavior, and custom space support
Reviewed Changes
Copilot reviewed 17 out of 19 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
provider/plugin_framework.go |
Registered the new default_data_view resource |
internal/kibana/default_data_view/*.go |
Complete resource implementation including CRUD operations, schema, and models |
internal/kibana/default_data_view/test_data/*.tf |
Test configurations for various scenarios |
internal/clients/kibana_oapi/data_views.go |
Added API client functions for getting and setting default data views |
examples/resources/elasticstack_kibana_default_data_view/resource.tf |
Example usage configuration |
docs/resources/kibana_default_data_view.md |
Generated resource documentation |
| }, | ||
| "force": schema.BoolAttribute{ | ||
| MarkdownDescription: "Update an existing default data view identifier. If set to false and a default data view already exists, the operation will fail.", | ||
| Optional: true, |
Copilot
AI
Nov 13, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The force attribute is missing Computed: true and a default value. According to the schema pattern and the PR description stating force defaults to true, this should include Computed: true and Default: booldefault.StaticBool(true) to match the documented behavior.
| Optional: true, | |
| Optional: true, | |
| Computed: true, | |
| Default: booldefault.StaticBool(true), |
Overview
This PR implements a new
elasticstack_kibana_default_data_viewresource that allows users to programmatically set the default Kibana data view, addressing the feature request in issue #XXX.Previously, users could only set the default data view manually through the Kibana UI (see screenshot below). This resource enables automated management of this setting through Terraform.
Changes
New Resource:
elasticstack_kibana_default_data_viewSchema:
data_view_id(required, string): The data view identifier to set as defaultforce(optional, bool, default: true): Update an existing default data view identifierskip_delete(optional, bool, default: false): If true, the default data view will not be unset when the resource is destroyedExample Usage:
Implementation Details
skip_deleteflagFiles Added
internal/kibana/default_data_view/- Complete resource implementation with CRUD operations, schema, models, and testsexamples/resources/elasticstack_kibana_default_data_view/resource.tf- Example configurationdocs/resources/kibana_default_data_view.md- Generated documentationTesting
✅ All acceptance tests pass:
✅ Manual end-to-end testing completed and verified all scenarios:
Related Issues
Closes #XXX
Original prompt
Fixes #603
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.